﻿//------------------------------------------------------------------------------
// ╭─────────────────────────────╮
// │ ╭─╮     ╭─╮              TM │   ╠═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╣
// │ │ │     │ │                 │                                           ☺  
// │ │ ╰───╮ │ │ ╭─────╮ ╭─────╮ │     Name:Wedn.Net 后台模版引擎        ♮ ♪ ♩
// │ │ ╭─╮ │ │ │ │ ╭─╮ │ │ ╭─╮ │ │                                    ♫ ♭      
// │ │ ╰─╯ │ │ │ │ ╰─╯ │ │ ╰─╯ │ │     Author:iceStone               ♬ ♪       
// │ └─────╯ └─╯ ╰─────╯ ╰───╮ │ │     Chinese:汪磊                              
// │                     ┌───╯ │ │                                              
// │                     ╰─────╯ │   ╠═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╣
// ╰─────────────────────────────╯                                              
//------------------------------------------------------------------------------
using System.Web.Mvc;

namespace Wedn.Net.TEngine
{
    /// <summary>
    /// 后台模版引擎
    /// </summary>
    public class AdminRazorViewEngine : RazorViewEngine
    {
        /// <summary>
        /// 后台模版引擎构造函数
        /// </summary>
        public AdminRazorViewEngine()
        {
            //Area视图路径其中{2},{1},{0}分别代表Area名，Controller名，Action名
            AreaViewLocationFormats = new[] { "~/Views/{2}/Admin/{0}.cshtml", "~/Views/Shared/{0}.cshtml" };
            //Area模版路径
            AreaMasterLocationFormats = new[] { "~/Views/Shared/{0}.cshtml" };
            //Area的分部视图路径
            AreaPartialViewLocationFormats = new[] { "~/Views/{2}/{1}/{0}.cshtml", "~/Views/Shared/{0}.cshtml" };
            //主视图路径
            ViewLocationFormats = new[] { "~/Views/{1}/{0}.cshtml", "~/Views/Shared/{0}.cshtml" };
            //主模版路径
            MasterLocationFormats = new[] { "~/Views/Shared/{0}.cshtml" };
            //主分部视图路径
            PartialViewLocationFormats = new[] { "~/Views/Admin/{0}.cshtml", "~/Views/Shared/{0}.cshtml" };
            FileExtensions = new[] { "cshtml" };
        }
    }
}
